package com.struts2.student.service;

import java.util.List;

import com.struts2.student.dao.MajorDao;
import com.struts2.student.dao.MajorDaoImpl;
import com.struts2.student.entity.Major;

public class MajorServiceImpl implements MajorService {
	/**
	 * 查询
	 * @return
	 */
	public List<Major> findMajor() {
		MajorDao majorDao = new MajorDaoImpl();
		return majorDao.findMajor();
	}
	/**
	 * 根据Id查询专业信息
	 * @param majorId
	 * @return
	 */
	public Major getMajor(Integer majorId) {
		MajorDao majorDao = new MajorDaoImpl();
		return majorDao.get(Major.class,majorId);
	}
	/**
	 * 保存
	 */
	public void saveMajor(Major major) {
		MajorDao majorDao = new MajorDaoImpl();
		majorDao.saveOrUpdate(major);
	}
	/**
	 * 删除
	 */
	public void deleteMajor(Major major) {
		MajorDao majorDao = new MajorDaoImpl();
		majorDao.delete(major);
	}


}
